Skip to content

perf: playground −427 KB client JS, catalogue props trim, status parity sync - #248

Merged
ronaldtse merged 3 commits into
mainfrom
site/perf-wo21
Nov 21, 2026
Merged

ronaldtse merged 3 commits into
mainfrom
site/perf-wo21

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Performance pass plus the two known cleanup items from the #245 round. Measured first; only safe wins taken.

  1. perf(playground) — the client script imported the full 616 KB maps-catalogue.json only to build a {code, name} list for the system select, bundling every entry's tests/invertibility/descriptions (~503 KB of JS on the page). The list is now trimmed at build time and injected as a data-systems attribute — the same pattern /api already uses. Also fixes the pre-existing eslint error (unused catalogue import) and the stale hardcoded "289" in prose + filter placeholder (now computed: 457).
  2. perf(maps) — Astro 7 both server-renders the island and serializes its props, so the catalogue page paid for every entry twice. Dropped props MapCatalogue never renders: language, sourceScriptName, destinationScriptName, invertibility.context_rules. No rendered or behavioral change.
  3. chore(status) — Ruby parity KPI synced to the current fixture on interscript-ts origin/main (test/fixtures/full-parity.json): 7,502 → 7,544 test vectors, 271 maps at 100.0% (unchanged); the regeneration comment now names the fixture file.

Before / after (same machine, npm run build, ~48 s both, 536 pages)

metric before (main @ 623905f) after delta
total client JS (32 files) 1,846,671 B 1,322,413 B −524 KB (−28.4%)
total client HTML (538 files) 17,652,387 B 17,636,583 B −15.8 KB
/playground JS 503,385 B (single file) 75,888 B (2,772 entry + 727 worker-client shim + 72,389 shared ml chunk) −427 KB (−85%)
/playground HTML 18,628 B 88,308 B +69.7 KB (the injected list)
/maps/index.html 1,517,171 B 1,481,154 B −36.0 KB
dist/ total 98 MB 95 MB −3 MB

Net for a cold /playground visit: −357 KB. The +70 KB of HTML streams and parses faster than the JS it replaces and no longer duplicates map metadata the worker engine never reads.

Measured but not taken (out of safe scope)

  • /maps still ships the catalogue twice (SSR markup ~833 KB + hydrated props ~650 KB): fixing that means restructuring the island to fetch-on-mount — a UX/SEO behavior change, not a safe win.
  • transliteration-worker (588 KB) and ort.bundle (407 KB) are the actual engines, already lazy-loaded; the 4 × 1.8 MB compiled library JSONs (posix/unicode/var-Cyrl/var-kor) are runtime data for the .iml fallback.
  • Fonts/images: 534 KB woff2 total, already subset variable fonts — nothing obvious.
  • Pre-existing stale "289" prose in about.astro, api.astro, ml.astro — left untouched (outside this round's named scope), same drift class as the playground fix; worth a follow-up.

Verification

  • astro check: 0 errors, 0 warnings; eslint on the four changed files: clean
  • e2e against the production build (playwright + local preview server): 6/6 pass — playground end-to-end transliteration through the worker, filter narrowing, maps cards/filters/count/detail navigation
  • vitest: 237 passed, 16 skipped, 2 failed — the two failures (acadsin-zho-Hani-Latn-2002, alalc-cjm-Cham-Latn-2015 full-map parse) reproduce identically on pristine main (verified in a worktree at 623905f): pre-existing, unrelated
  • API smoke on the built server (node dist/server/entry.mjs): /api/systems → 200 {"count":457,...}, ?authority=bgnpcgn → 200, access-control-allow-origin: *, /api/transliterate round-trip Антон → Anton
  • vitest api-endpoints file locally skips under CPU contention (12 s boot timeout while other suites ran); the direct curl smoke above is the evidence for this round

…616 KB catalogue no longer ships in the client bundle

The client script imported maps-catalogue.json only to build a {code, name}
list for the system select, bundling every entry's tests, invertibility and
descriptions into the page (~503 KB of JS). The list is now trimmed in the
frontmatter and injected as a data attribute (same pattern as /api), dropping
the page's JS to ~76 KB. Prose and the filter placeholder read the count from
the same source, so the hardcoded 289 (stale since the 450/457 waves) cannot
drift again; this also clears the unused-import eslint error.
…on payload shrinks by ~36 KB

Astro 7 both server-renders the island and serializes its props, so the
catalogue page paid for every entry twice. language, sourceScriptName,
destinationScriptName and invertibility.context_rules were never read by the
component; drop them from the props mapping and the interface.
…t vectors

The sample count was hardcoded at 7,502; the fixture on interscript-ts
origin/main (test/fixtures/full-parity.json) holds 7,544 vectors across 271
maps at 100.0%. Point the regeneration comment at the fixture file.
@ronaldtse
ronaldtse merged commit be17a92 into main Nov 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant